// 防止重复加载房间蓝图 || Prevent duplicate loading of room blueprint
#ifndef ROOM_HH
#define ROOM_HH

// 包含必要组件 || Include required components
#include "ICharacter.hh"  // 角色接口（敌人模板） || Character interface (enemy template)
#include "Item.hh"        // 物品模板（装备道具） || Item template (equipment props)
#include <string>         // 文字处理工具 || Text handling tools
#include <vector>         // 动态列表容器（类似伸缩收纳盒） || Dynamic list container (like expandable storage box)

// 房间类（游戏地图的基本单元） || Room class (basic unit of game map)
class Room {
private:
    // ====== 房间属性 ====== || ====== Room Properties ======
    std::string description;  // 房间描述（例如："阴森的地牢"） || Room description (e.g., "Spooky dungeon")
    
    // 四个方向的出口门牌号 || Doorways to adjacent rooms
    Room* north;  // 北边房间地址 || Northern room address
    Room* south;  // 南边房间地址 || Southern room address
    Room* east;   // 东边房间地址 || Eastern room address
    Room* west;   // 西边房间地址 || Western room address
    
    std::vector<Item*> items;       // 物品收纳盒（动态容量） || Item container (flexible capacity)
    std::vector<ICharacter*> enemies; // 敌人名单（可变数量） || Enemy list (variable quantity)
    
    std::string task;           // 房间任务要求（例如："击败所有敌人"） || Room objective (e.g., "Defeat all enemies")
    bool taskCompleted;         // 任务完成状态标记 || Mission completion status flag

public:
    // ====== 房间建造与销毁 ====== || ====== Room Construction & Destruction ======
    // 房间建造指南（创建新房间的配方） || Room construction guide (recipe for new rooms)
    Room(std::string desc, std::string t = "");  // 参数：描述 + 可选任务 || Params: description + optional task
    
    // 房间拆除方法（清理房间内存） || Room demolition method (clean up memory)
    ~Room();

    // ====== 连接房间 ====== || ====== Connect Rooms ======
    // 设置四向出口（连接其他房间的门） || Set exits (doors connecting to other rooms)
    void setExits(Room* n, Room* s, Room* e, Room* w);  // 参数：四个方向房间地址 || Params: four directional room addresses

    // ====== 填充房间内容 ====== || ====== Populate Room Content ======
    void addItem(Item* item);      // 放入道具（添加到物品列表） || Place item (add to item list)
    void addEnemy(ICharacter* enemy); // 添加敌人（加入敌人名单） || Add enemy (include in enemy roster)

    // ====== 获取房间信息 ====== || ====== Get Room Information ======
    std::string getDescription() const;  // 读取房间描述 || Read room description
    
    // 获取出口信息（查看连接的门） || Get exit info (check connected doors)
    Room* getNorth() const;  // 查看北门通向哪里 || Check where north door leads
    Room* getSouth() const;  // 查看南门通向哪里 || Check where south door leads
    Room* getEast() const;   // 查看东门通向哪里 || Check where east door leads
    Room* getWest() const;   // 查看西门通向哪里 || Check where west door leads
    
    // 获取内容列表（允许修改容器内物品） || Get content lists (allow modifying contents)
    std::vector<Item*>& getItems();      // 获取物品收纳盒 || Access item container
    std::vector<ICharacter*>& getEnemies(); // 获取敌人名单 || Access enemy roster

    // ====== 任务管理 ====== || ====== Task Management ======
    std::string getTask() const { return task; }          // 查看当前任务 || Check current objective
    bool isTaskCompleted() const { return taskCompleted; } // 检查任务状态 || Verify mission status
    void completeTask() { taskCompleted = true; }        // 标记任务完成 || Mark mission as completed
};

// 结束头文件保护 || End of header guard
#endif // ROOM_HH